<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Cache-Control" content="No-Cache">
	<meta http-equiv="Pragma" content="No-Cache">

	<title>운세의 신</title>

	<link rel="stylesheet" type="text/css" href="/css/common.css">
	
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script src="/js/common_basic.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#keyword").focus();
		});
	
		function openArtistDetail(idx) {
			window.open('/star/starunse/artist_detail?idx='+idx, 'popup', 'width=650, height=650, toolbar=no,directories=no,scrollbars=yes,resizable=no,status=no,menubar=no,top=0,left=0');
		}

		function openNewArtist() {
			window.open('/star/starunse/register_form', 'popup', 'width=650, height=650, toolbar=no,directories=no,scrollbars=yes,resizable=no,status=no,menubar=no,top=0,left=0');
		}

		function removeArtist(idx) {
			if (confirm('삭제?')) {
				document.frm2.idx.value = idx;
				document.frm2.submit();
			}
		}
		
		// 정렬
		function orderBy(order) {
			if (order == $("#order").val()) {
				if($("#sort").val() == 'asc') {
					$("#sort").val("desc");
				} else {
					$("#sort").val("asc");
				}
			} else {
				$("#order").val(order);
				$("#sort").val("asc");
			}
			$("#frm").submit();
		}
		
		// 페이지 이동
		function goPage(page) {
			$("#page").val(page);
			$("#frm").submit();
		}
	</script>
</head>
<body>

<form method="post" name="frm2" id="frm2" action="/star/starunse/remove_ok">
	<input type="hidden" name="idx" />
	<input type="hidden" name="page" value="<?=!empty($_GET['page']) ? $_GET['page'] : '1'?>" />
	<input type="hidden" name="order" value="<?=!empty($_GET['order']) ? $_GET['order'] : 'idx'?>" />
	<input type="hidden" name="sort" value="<?=!empty($_GET['sort']) ? $_GET['sort'] : 'desc'?>" />
</form>
<div id="wrap">
	<!-- Header -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/header.php'; ?>
	<!--// Header -->
	
	<!-- Contents -->
	<div id="content">
		<h2>스타 정보 관리 - 리스트</h2>
		
		<form method="get" name="frm" id="frm" action="/star/starunse">
			<input type="hidden" name="page" id="page" value="1" />
			<input type="hidden" name="order" id="order" value="<?=!empty($_GET['order']) ? $_GET['order'] : 'idx'?>" />
			<input type="hidden" name="sort" id="sort" value="<?=!empty($_GET['sort']) ? $_GET['sort'] : 'desc'?>" />
			<input type="text" name="keyword" id="keyword" value="<?=!empty($_GET['keyword']) ? $_GET['keyword'] : ''?>" />
			<input type="submit" value="검색"/> <input type="button" value="모두보기" onclick="location.href='/star/starunse'"/>
		</form>
		
		<input type="button" value="신규등록" onclick="openNewArtist()"/>
		<div>
			<table class="basicTable" width="100%" cellpadding="2" cellspacing="1" border="0">
				<thead>
					<tr>
						<th><a href="javascript:;" onclick="orderBy('idx')">No</a></th>
						<th>사진</th>
						<th><a href="javascript:;" onclick="orderBy('artist_name')">이름</a></th>
						<th>검색어</th>
						<th><a href="javascript:;" onclick="orderBy('sex')">성별</a></th>
						<th><a href="javascript:;" onclick="orderBy('job')">직업</a></th>
						<th>신체</th>
						<th><a href="javascript:;" onclick="orderBy('birth_yyyy')">생년월일</a></th>
						<th>상세보기</th>
						<th>삭제</th>
					</tr>
				</thead>
				<tbody>
<?	foreach ($artist_list as $items) : ?>
					<tr>
						<td align="center"><input type="hidden" name="idx[]" value="<?=$items['idx']?>" /><?=$items['idx']?></td>
						<td align="center"><img src="<?=$items['photo']?>" width="20" height="25" /></td>
						<td align="center"><?=$items['artist_name']?></td>
						<td align="center"><?=$items['keyword']?></td>
						<td align="center"><?=$items['sex']?></td>
						<td align="center"><?=$items['job']?></td>
						<td align="center"><?=$items['body']?></td>
						<td align="center"><?=$items['birth_yyyy']?>년 <?=$items['birth_mm']?>월 <?=$items['birth_dd']?>일</td>
						<td align="center"><button onclick="openArtistDetail('<?=$items['idx']?>')">보기/수정</button></td>
						<td align="center"><button onclick="removeArtist('<?=$items['idx']?>')">삭제</button></td>
					</tr>
<?	endforeach ?>
				</tbody>
				<tfoot>
					<tr>
						<td colspan="10">
							<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/board/page_navi.php'; ?>
						</td>
					</tr>
				</tfoot>
			</table>
		</div>
	</div>
	<!--// Contents -->
	
	<!-- Footer -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/footer.php'; ?>
	<!--// Footer -->
</div>
</body>
</html>